package models;

import static com.google.common.base.Objects.toStringHelper;

import java.util.ArrayList;
import java.util.List;

import com.google.common.base.Objects;

public class Activity {
      public Long id;  
	  public String type; 
	  public String location; 
	  public Double distance;
	  static long counter = 0l;
	  public List<Location> route = new ArrayList<Location>();
	  
	  public Activity(String type,String location,Double distance){
		  this.id = counter++;
		  this.type = type;
		  this.location = location;
		  this.distance = distance;
	  }
	  
	  @Override
	  public String toString()
	  {
	    return toStringHelper(this).addValue(id)
	    						   .addValue(type)
	                               .addValue(location)
	                               .addValue(distance)
	                               .addValue(route)
	                               .toString();
	  }
	  
	  @Override  
	  public int hashCode()  
	  {  
	     return Objects.hashCode(this.id, this.type, this.location, this.distance, this.route);  
	  }
	  
	  // get ID of specified activity
	  public long getId(){
		  return this.id;
	  }
	  
	  @Override
	  public boolean equals(final Object obj)
	  {
	    if (obj instanceof Activity)
	    {
	      final Activity other = (Activity) obj;
	      return Objects.equal(type, other.type) 
	          && Objects.equal(location,  other.location)
	          && Objects.equal(distance,  other.distance)
	          && Objects.equal(route,     other.route);    
	    }
	    else
	    {
	      return false;
	    }
	  }
	  
}
